package net.towee.client.widgets.upload;


/**
 * Interface consists of methods for getting information about uploading file.
 * All what can be got by Flash/HTML4/HTML5 methods. Also it contain methods for
 * control uploading progress and handlers.
 * 
 * @author c58
 */
public interface UploadItem {
	public static enum UploadState {
		STARTED, CANCELED, ERROR, QUEUED, COMPLITED
	};

	/**
	 * Handler for control uploading progress
	 * 
	 * @param handler
	 * @return
	 */
	void setProgressHandler(UploadProgressHandler handler);
	
	/**
	 * Start uploading
	 */
	void start();

	/**
	 * Cancel uploading of given file. It invoke onCancelUploading method in
	 * progress handler.
	 */
	void cancel();

	/**
	 * @return uploading file name without path and with extension
	 */
	String getFileName();

	/**
	 * @return size of file or -1 if size not presented (HTML4 mode)
	 */
	long getFileSize();

	/**
	 * @return response of server if uploading complited or null otherwise.
	 */
	String getResponse();

	/**
	 * @return true if file uploaded
	 */
	boolean isComplited();
	
	/**
	 * @return if file in uploading queue
	 */
	boolean isQueued();
	
	/**
	 * @return true if uploading canceled
	 */
	boolean isCanceled();

	/**
	 * @return true if uploading complited with error
	 */
	boolean isError();
}
